<?php

declare(strict_types=1);
/**
 * 商户-收货地址
 * @author chenshubo
 */
namespace App\Controller\Shop;

use App\Model\PssModel\MerchantAdress;
use App\Model\PssModel\Area;
use Hyperf\HttpServer\Contract\RequestInterface;
use App\Model\PssModel\MerchantBuyer;
class AddressController extends AbstractController
{    
    /**
     * 保存收货地址
     */
    public function addAddress(RequestInterface $request) 
    {
        return MerchantAdress::instance()->addUserAddress($request->getAttribute('param'));
    }
    
    /**
     * 保存收货地址
     */
    public function editAddress(RequestInterface $request)
    {
        return MerchantAdress::instance()->editUserAddress($request->getAttribute('param'));
    }
    
    /**
     * 删除收货地址
     */
    public function delUserAddress(RequestInterface $request)
    {
        return MerchantAdress::instance()->delUserAddress($request->getAttribute('param'));
    }
    
    /**
     * 收货地址列表管理
     * @param number $bid
     */
    public function getUserAddressList(RequestInterface $request) 
    {
        $param = $request->getAttribute('param');
        return MerchantAdress::instance()->getUserAddressList($param['binfo']['id']);
    }
    
    public function getAreaList( $pid = 0 ) 
    {
        return Area::instance()->getAreaList($pid);
    }
    
    /**
     * 订购人信息列表展示
     * @param number $bid
     */
    public function getBuyerInfoList(RequestInterface $request)
    {
        $param = $request->getAttribute('param');
        return MerchantBuyer::instance()->getBuyerInfoList($param);
    }
}
